package com.qf.user.factory.registerfactory;

import com.qf.common.core.exception.CustomerException;
import com.qf.user.service.UserService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author zdl
 * @date 2025/3/22
 */
//注册工厂类
@Component
public class RegistrationFactory {
    @Resource
    private UserNameAndPassWordRegistration userNameAndPassWordRegistration;
    @Resource
    private PhoneAndVerificationCodeRegistration phoneAndVerificationCodeRegistration;

    public Registration registration(Integer type) {
        switch (type) {
            case 1:
                return userNameAndPassWordRegistration;
            case 2:
                return phoneAndVerificationCodeRegistration;
            default:
                throw new CustomerException("6001","注册类型不存在");
        }
    }
}
